﻿// MFCApplication2View.h: CMFCApplication2View 类的接口
//

#pragma once

#include "AIS_ViewController.hxx"

enum CurAction3d
{
	CurAction3d_Nothing,
	CurAction3d_DynamicZooming,
	CurAction3d_WindowZooming,
	CurAction3d_DynamicPanning,
	CurAction3d_GlobalPanning,
	CurAction3d_DynamicRotation
};

class CMFCApplication2View : public CView, public AIS_ViewController
{
protected: // 仅从序列化创建
	CMFCApplication2View() noexcept;
	DECLARE_DYNCREATE(CMFCApplication2View)
	void update3dView();
	// 特性
public:
	CMFCApplication2Doc* GetDocument() const;

	// 操作
public:

	// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

	// 实现
  //! Setup mouse gestures.
	void defineMouseGestures();

	//! Get current action.
	CurAction3d getCurrentAction() const { return myCurrentMode; }

	//! Set current action.
	void setCurrentAction(CurAction3d theAction)
	{
		myCurrentMode = theAction;
		defineMouseGestures();
	}

	virtual void handleViewRedraw(const Handle(AIS_InteractiveContext)& theCtx,
		const Handle(V3d_View)& theView);
public:
	virtual ~CMFCApplication2View();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

	Handle(V3d_View) myView;
	AIS_MouseGestureMap myDefaultGestures;
	Graphic3d_Vec2i     myClickPos;
	Standard_Real       myCurZoom;
	unsigned int        myUpdateRequests; //!< counter for unhandled update requests
	CurAction3d         myCurrentMode;

	// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
public:
	virtual void OnInitialUpdate();
	afx_msg void OnViewFront();
	afx_msg void OnViewTop();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnMouseWheel(UINT theFlags, short theDelta, CPoint thePoint);
	afx_msg void OnMouseMove(UINT theFlags, CPoint thePoint);
	afx_msg void OnMouseLeave();
	afx_msg void OnLButtonDown(UINT theFlags, CPoint thePoint);
	afx_msg void OnLButtonUp(UINT theFlags, CPoint thePoint);
	afx_msg void OnMButtonDown(UINT theFlags, CPoint thePoint);
	afx_msg void OnMButtonUp(UINT theFlags, CPoint thePoint);
	afx_msg void OnRButtonDown(UINT theFlags, CPoint thePoint);
	afx_msg void OnRButtonUp(UINT theFlags, CPoint thePoint);
	afx_msg void OnCadImport();
	afx_msg void OnSelectionFace();
};

#ifndef _DEBUG  // MFCApplication2View.cpp 中的调试版本
inline CMFCApplication2Doc* CMFCApplication2View::GetDocument() const
{
	return reinterpret_cast<CMFCApplication2Doc*>(m_pDocument);
}
#endif
